home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / icon_utl / 32to20 / 32to16.frm next >
Text File  |  1995-10-17  |  10KB  |  323 lines

  1. VERSION 2.00
  2. Begin Form IconToBmp 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "32 icon to 20 bmp Converter"
  6.    ClientHeight    =   2952
  7.    ClientLeft      =   2328
  8.    ClientTop       =   2532
  9.    ClientWidth     =   4932
  10.    Height          =   3336
  11.    Icon            =   32TO16.FRX:0000
  12.    Left            =   2280
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   2952
  17.    ScaleWidth      =   4932
  18.    Top             =   2196
  19.    Width           =   5028
  20.    Begin CheckBox Check3 
  21.       BackColor       =   &H00FFFFFF&
  22.       Caption         =   "Grey BackGround"
  23.       FontBold        =   0   'False
  24.       FontItalic      =   0   'False
  25.       FontName        =   "MS Sans Serif"
  26.       FontSize        =   7.8
  27.       FontStrikethru  =   0   'False
  28.       FontUnderline   =   0   'False
  29.       Height          =   264
  30.       Left            =   216
  31.       TabIndex        =   9
  32.       Top             =   2520
  33.       Width           =   1596
  34.    End
  35.    Begin PictureBox Picture2 
  36.       AutoRedraw      =   -1  'True
  37.       AutoSize        =   -1  'True
  38.       Height          =   264
  39.       Left            =   3384
  40.       ScaleHeight     =   240
  41.       ScaleWidth      =   240
  42.       TabIndex        =   8
  43.       Top             =   672
  44.       Width           =   264
  45.    End
  46.    Begin PictureBox Picture1 
  47.       AutoRedraw      =   -1  'True
  48.       AutoSize        =   -1  'True
  49.       BackColor       =   &H00FFFFFF&
  50.       Height          =   408
  51.       Left            =   3384
  52.       ScaleHeight     =   384
  53.       ScaleWidth      =   384
  54.       TabIndex        =   5
  55.       Top             =   216
  56.       Width           =   408
  57.    End
  58.    Begin CommandButton Command1 
  59.       Caption         =   "C&onvert"
  60.       Default         =   -1  'True
  61.       FontBold        =   0   'False
  62.       FontItalic      =   0   'False
  63.       FontName        =   "MS Sans Serif"
  64.       FontSize        =   7.8
  65.       FontStrikethru  =   0   'False
  66.       FontUnderline   =   0   'False
  67.       Height          =   348
  68.       Index           =   1
  69.       Left            =   2784
  70.       TabIndex        =   4
  71.       Top             =   2520
  72.       Width           =   972
  73.    End
  74.    Begin CommandButton Command1 
  75.       Cancel          =   -1  'True
  76.       Caption         =   "&Cancel"
  77.       FontBold        =   0   'False
  78.       FontItalic      =   0   'False
  79.       FontName        =   "MS Sans Serif"
  80.       FontSize        =   7.8
  81.       FontStrikethru  =   0   'False
  82.       FontUnderline   =   0   'False
  83.       Height          =   348
  84.       Index           =   0
  85.       Left            =   3840
  86.       TabIndex        =   3
  87.       Top             =   2520
  88.       Width           =   972
  89.    End
  90.    Begin DriveListBox Drive1 
  91.       FontBold        =   0   'False
  92.       FontItalic      =   0   'False
  93.       FontName        =   "MS Sans Serif"
  94.       FontSize        =   7.8
  95.       FontStrikethru  =   0   'False
  96.       FontUnderline   =   0   'False
  97.       Height          =   288
  98.       Left            =   1488
  99.       TabIndex        =   2
  100.       Top             =   1992
  101.       Width           =   1788
  102.    End
  103.    Begin DirListBox Dir1 
  104.       FontBold        =   0   'False
  105.       FontItalic      =   0   'False
  106.       FontName        =   "MS Sans Serif"
  107.       FontSize        =   7.8
  108.       FontStrikethru  =   0   'False
  109.       FontUnderline   =   0   'False
  110.       Height          =   1752
  111.       Left            =   1488
  112.       TabIndex        =   1
  113.       Top             =   168
  114.       Width           =   1788
  115.    End
  116.    Begin FileListBox File1 
  117.       FontBold        =   0   'False
  118.       FontItalic      =   0   'False
  119.       FontName        =   "MS Sans Serif"
  120.       FontSize        =   7.8
  121.       FontStrikethru  =   0   'False
  122.       FontUnderline   =   0   'False
  123.       Height          =   2136
  124.       Left            =   168
  125.       Pattern         =   "*.ico"
  126.       TabIndex        =   0
  127.       Top             =   144
  128.       Width           =   1260
  129.    End
  130.    Begin Label Label2 
  131.       BackStyle       =   0  'Transparent
  132.       Caption         =   "This program will convert a 32 by 32 icon to a 20 by 20 bmp. It will convert all the icons in the directory."
  133.       FontBold        =   0   'False
  134.       FontItalic      =   0   'False
  135.       FontName        =   "MS Sans Serif"
  136.       FontSize        =   7.8
  137.       FontStrikethru  =   0   'False
  138.       FontUnderline   =   0   'False
  139.       Height          =   1260
  140.       Left            =   3384
  141.       TabIndex        =   10
  142.       Top             =   1056
  143.       Width           =   1428
  144.       WordWrap        =   -1  'True
  145.    End
  146.    Begin Line Line5 
  147.       BorderColor     =   &H00808080&
  148.       X1              =   192
  149.       X2              =   192
  150.       Y1              =   2496
  151.       Y2              =   2808
  152.    End
  153.    Begin Line Line4 
  154.       BorderColor     =   &H00FFFFFF&
  155.       X1              =   1824
  156.       X2              =   1824
  157.       Y1              =   2808
  158.       Y2              =   2496
  159.    End
  160.    Begin Line Line3 
  161.       BorderColor     =   &H00FFFFFF&
  162.       X1              =   192
  163.       X2              =   1848
  164.       Y1              =   2808
  165.       Y2              =   2808
  166.    End
  167.    Begin Line Line2 
  168.       BorderColor     =   &H00808080&
  169.       X1              =   192
  170.       X2              =   1848
  171.       Y1              =   2496
  172.       Y2              =   2496
  173.    End
  174.    Begin Label Label1 
  175.       AutoSize        =   -1  'True
  176.       BackStyle       =   0  'Transparent
  177.       Caption         =   "20x20 Bmp"
  178.       FontBold        =   0   'False
  179.       FontItalic      =   0   'False
  180.       FontName        =   "MS Sans Serif"
  181.       FontSize        =   7.8
  182.       FontStrikethru  =   0   'False
  183.       FontUnderline   =   0   'False
  184.       Height          =   192
  185.       Index           =   1
  186.       Left            =   3888
  187.       TabIndex        =   7
  188.       Top             =   696
  189.       Width           =   780
  190.    End
  191.    Begin Label Label1 
  192.       AutoSize        =   -1  'True
  193.       BackStyle       =   0  'Transparent
  194.       Caption         =   "32x32 Icon"
  195.       FontBold        =   0   'False
  196.       FontItalic      =   0   'False
  197.       FontName        =   "MS Sans Serif"
  198.       FontSize        =   7.8
  199.       FontStrikethru  =   0   'False
  200.       FontUnderline   =   0   'False
  201.       Height          =   192
  202.       Index           =   0
  203.       Left            =   3888
  204.       TabIndex        =   6
  205.       Top             =   288
  206.       Width           =   744
  207.    End
  208.    Begin Line Line1 
  209.       BorderColor     =   &H00FFFFFF&
  210.       Index           =   1
  211.       X1              =   168
  212.       X2              =   4800
  213.       Y1              =   2424
  214.       Y2              =   2424
  215.    End
  216.    Begin Line Line1 
  217.       BorderColor     =   &H00808080&
  218.       Index           =   0
  219.       X1              =   168
  220.       X2              =   4800
  221.       Y1              =   2400
  222.       Y2              =   2400
  223.    End
  224. End
  225. Declare Function StretchBlt Lib "GDI" (ByVal hDC%, ByVal X%, ByVal Y%, ByVal nWidth%, ByVal nHeight%, ByVal hSrcDC%, ByVal XSrc%, ByVal YSrc%, ByVal nSrcWidth%, ByVal nSrcHeight%, ByVal dwRop&) As Integer
  226. Const SRCCOPY = &HCC0020
  227.  
  228. ' ************************************************
  229. ' * Code written originally by Richard Ratayczak *
  230. ' * Put in Public Domain on 10/18/95.            *
  231. ' * But if you make any money off the code, send *
  232. ' * me some!                                     *
  233. ' *                                              *
  234. ' * Richard Ratayczak                            *
  235. ' * diskdesk@execpc.com                          *
  236. ' * http://www.execpc.com/~diskdesk/             *
  237. ' ************************************************
  238.  
  239. Sub Check3_Click ()
  240. If Check3.Value = 0 Then
  241.     Check3.BackColor = &HFFFFFF
  242.     Picture1.BackColor = &HFFFFFF
  243.     Picture2.BackColor = &HFFFFFF
  244. Else
  245.     Check3.BackColor = &HC0C0C0
  246.     Picture1.BackColor = &HC0C0C0
  247.     Picture2.BackColor = &HC0C0C0
  248. End If
  249. End Sub
  250.  
  251. Sub Command1_Click (Index As Integer)
  252. Command1(1).Enabled = False
  253. Command1(0).Enabled = False
  254. ' ByVal hDC%, ByVal X%, ByVal Y%
  255. ' ByVal nWidth%, ByVal nHeight%
  256. ' ByVal hSrcDC%, ByVal XSrc%, ByVal YSrc%
  257. ' ByVal nSrcWidth%, ByVal nSrcHeight%
  258. ' ByVal dwRop&
  259. Dim FileName As String
  260. If Index = 1 Then
  261.     ChDrive Drive1.Drive
  262.     ChDir File1.Path
  263.     If File1.ListCount <> -1 Then
  264.         For A = 0 To File1.ListCount - 1
  265.             File1.ListIndex = A
  266.             Picture1.Picture = LoadPicture(File1.List(A))
  267.             Picture1.Refresh
  268.             X% = StretchBlt(Picture2.hDC, 0, 0, 20, 20, Picture1.hDC, 0, 0, 32, 32, SRCCOPY)
  269.             Picture2.Picture = Picture2.Image
  270.             Picture2.Refresh
  271.             FileName = Left$(File1.List(A), Len(File1.List(A)) - 3) + "bmp"
  272.             SavePicture Picture2.Image, FileName
  273.         Next A
  274.     End If
  275.     Command1(1).Enabled = True
  276.     Command1(0).Enabled = True
  277. End If
  278. If Index = 0 Then End
  279.  
  280. End Sub
  281.  
  282. Sub Dir1_Change ()
  283. File1.Path = Dir1.Path
  284. End Sub
  285.  
  286. Sub Drive1_Change ()
  287. Dir1.Path = Drive1.Drive
  288. End Sub
  289.  
  290. Sub File1_Click ()
  291. ChDrive Drive1.Drive
  292. ChDir Dir1.Path
  293. Picture1.Picture = LoadPicture(File1.FileName)
  294. Picture1.Refresh
  295. End Sub
  296.  
  297. Sub File1_DblClick ()
  298. ChDrive Drive1.Drive
  299. ChDir Dir1.Path
  300. Picture1.Picture = LoadPicture(File1.FileName)
  301. Picture1.Refresh
  302. X% = StretchBlt(Picture2.hDC, 0, 0, 20, 20, Picture1.hDC, 0, 0, 32, 32, SRCCOPY)
  303. Picture2.Picture = Picture2.Image
  304. Picture2.Refresh
  305. FileName = Left$(File1.List(A), Len(File1.List(A)) - 3) + "bmp"
  306. SavePicture Picture2.Image, FileName
  307.  
  308. End Sub
  309.  
  310. Sub Form_Load ()
  311. top = screen.Height / 2 - Me.Height / 2
  312. left = screen.Width / 2 - Me.Width / 2
  313. End Sub
  314.  
  315. Sub Form_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  316. 'If Button = 1 Then
  317. '    File1.Pattern = "*.ico"
  318. 'Else
  319. '    File1.Pattern = "*.bmp"
  320. 'End If
  321. End Sub
  322.  
  323.